#!/bin/bash

CellName=$1
OASISName=$2
SPIName=$3

LayoutCellName=$CellName
ScheCellName=$CellName

gds_strmfile=$OASISName
netlistFilename=$SPIName


### setting
lvs_rule="/projects/analog_ip/workspace/xwqiu/cl/tacoma6/verify/LVS/DFM_LVS_RC_CALIBRE_N6_1p13M_1X1Xa1Ya5Y2Yy2Z_ALRDL.1.0b"
run_dir="/projects/analog_ip/workspace/xwqiu/cl/tacoma6/verify/LVS"


### run LVS
cd ${run_dir}

echo "LAYOUT PRIMARY '${LayoutCellName}'" > ./LVS.cal
echo "LAYOUT PATH '${gds_strmfile}'" >> ./LVS.cal
echo "LAYOUT SYSTEM OASIS" >> ./LVS.cal

echo "SOURCE PRIMARY '${ScheCellName}'" >> ./LVS.cal
echo "SOURCE PATH '${netlistFilename}'" >> ./LVS.cal
echo "SOURCE SYSTEM SPICE" >> ./LVS.cal

echo "LVS POWER NAME 'VDD' 'VDD?' 'VPP'" >> ./LVS.cal
echo "LVS GROUND NAMe 'VSS' 'GNDC' 'VSS?' 'VBB'" >> ./LVS.cal
echo "LAYOUT RENAME TEXT \"_\\\\[_<_g\" \"_\\\\]_>_g\"" >> ./LVS.cal

echo "INCLUDE '${lvs_rule}'" >> ./LVS.cal

cd ${run_dir}/run_LVS
/apps/mentor/Calibre_2019.3_25.15/aoi_cal_2019.3_25.15/bin/calibre -lvs -hier -hyper -turbo 32 ../LVS.cal | tee DRC.log